﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TowerDefense.Units;
using Microsoft.Xna.Framework;

namespace TowerDefense.Debuffs
{
    public class DamageOverTime : Effect
    {
        public DamageOverTime(double damagePerSecond, TimeSpan duration)
        {
            this.Duration = duration;
            this.DamagePerSecond = damagePerSecond;
        }

        public double DamagePerSecond
        {
            get;
            set;
        }

        public override void ApplyEffect(Creep C, GameTime gameTime)
        {
            this.Duration -= gameTime.ElapsedGameTime;
            C.Health -= DamagePerSecond * (double)gameTime.ElapsedGameTime.Milliseconds / 1000;
        }

        public override Effect Clone()
        {
            return new DamageOverTime(this.DamagePerSecond, this.Duration);
        }
    }
}
